import api from './api';

/**
 * 订单列表
 */
export function orderTakeFoods(data) {
  return api.get('/order/list', data, { login: false });
}

/**
 * 订单创建
 */
export function orderSubmit(data) {
  return api.post(`/order/create`, data, { login: false });
}

/**
 * 订单列表
 */
export function orderGetOrders(data) {
  return api.get(`/order/list`, data, { login: false });
}

/**
 * 计算详情
 */
export function orderDetail(data) {
  return api.get(`/order/detail/${data}`);
}

/**
 * 订单收货
 */
export function orderReceive(data) {
  return api.post(`/order/take`, data, { login: false });
}

/**
 * 订单退款
 */
export function orderRefund(data) {
  return api.post(`/order/refund`, data, { login: false });
}

/**
 * 订单支付
 */
export function payUnify(data) {
  return api.post(`/order/pay`, data, { login: false });
}

/**
 * getWechatConfig
 */
export function getWechatConfig() {
  return api.get(
    `/member/wx-mp/create-jsapi-signature`,
    { url: location.href },
    { login: false }
  );
}

export function cancelDue(data) {
  return api.get('/order/cancelDue', data, { login: true });
}

export function offPay(data) {
  return api.get('/order/offPay', data, { login: true });
}

/**
 * 发送购物车消息
 */
export function syncCart(data) {
  return api.post(`/order/sync-cart`, data, { login: false });
}

export function getShareCart(data) {
  return api.get('/order/get-share-cart', data, { login: true });
}

export function getDesk(data) {
  return api.get('/due/get-desk-info', data, { login: true });
}

export function scanBookTable(data) {
  return api.post('/api/v1/scanBookTable', data, { login: true });
}

//根据shop ID 获取shop信息
export function DoGetShopByIdApi(param) {
    return api.post('/api/v1/shopInfo', param, { login: true })
}

//根据shop ID 获取shop信息
export function DoGetRateAndCurrencySymbolApi(param) {
    return api.post('/api/v1/getRateAndCurrencySymbol', param, { login: true })
}